package com.hjx.movie.core.system.service.admin.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hjx.movie.core.system.service.admin.IOrderItemService;
import com.hjx.movie.persistence.system.mapper.IvyOrderItemMapper;
import com.hjx.movie.persistence.system.model.IvyOrderItem;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>Title:</p>
 * <p>Description:</p>
 *
 * @author hjx
 * @date 2021/2/15 - 14:58
 */
@Slf4j
@Service
@Transactional
@CacheConfig(cacheNames = "IvyMovie:SpringCache:OrderItemCache",keyGenerator = "cacheKeyGenerator")
public class OrderItemService extends ServiceImpl<IvyOrderItemMapper, IvyOrderItem> implements IOrderItemService {

    @Override
    public boolean addOrderItem(IvyOrderItem orderItem) {
        return save(orderItem);
    }

    @Override
    public boolean updateOrderItem(IvyOrderItem orderItem) {
        return updateById(orderItem);
    }

    @Override
    public boolean deleteOrderItem(Long orderItemId) {
        return removeById(orderItemId);
    }

    @Override
    public List<IvyOrderItem> findAll() {
        return list();
    }
}
